package core.filter;

import javax.servlet.*;
import java.io.IOException;

/**
 * @author wsz
 * @date 2021/10/28 19:30
 **/
public class EncodingFilter implements Filter {

    @Override
    public void init(FilterConfig filterConfig) {
    }

    @Override
    public void destroy() {
    }

    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        servletRequest.setCharacterEncoding("GBK");
        servletResponse.setCharacterEncoding("GBK");
        filterChain.doFilter(servletRequest, servletResponse);
    }
}
